//
//  ViewController.m
//  QT
//
//  Created by 甘世清 on 2024/10/14.
//

#import "ViewController.h"
#import "MessageViewController.h"
#import "PeopleMapViewController.h"
#import "MeViewController.h"
#import "PictureViewController.h"
#import "SouSuoViewController.h"
@interface ViewController ()
@property (nonatomic , strong) PictureViewController * homeVC;
@property (nonatomic , strong) PeopleMapViewController * aiVC;
@property (nonatomic , strong) SouSuoViewController * sousuo;
@property (nonatomic , strong) MessageViewController * messageVC;
@property (nonatomic , strong) MeViewController * meVC;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [[SQCLLocationManager sharedManager] SQ_startUpdatingLocation];
    self.view.backgroundColor = SQColorF1F1F1;
    [self SQ_UIViewForSelfView];
}
-(void)SQ_UIViewForSelfView{
    [self setTabBarFrame:CGRectMake(0, SCREEN_HEIGHT-40-FootHeight, SCREEN_WIDETH, 40+FootHeight)
        contentViewFrame:CGRectMake(0, 0, SCREEN_WIDETH, SCREEN_HEIGHT-FootHeight-40)];
    self.tabContentView.loadViewOfChildContollerWhileAppear = YES;
    self.tabContentView.delegate = self;
   
    [self.tabBar setItemContentHorizontalCenterAndMarginTop:14 spacing:0];
    
    self.viewControllers = [NSMutableArray arrayWithObjects:self.homeVC, self.aiVC,self.sousuo,self.messageVC,self.meVC,nil];
    [self.tabBar setItemContentHorizontalCenterAndMarginTop:14 spacing:0];
    [self.sousuo.yp_tabItem setContentHorizontalCenterAndMarginTop:4 spacing:0];

    UIView * lineView = [[UIView alloc]init];
    lineView.backgroundColor = SQHexColor(@"#000000", 0.1);
    [self.tabBar addSubview:lineView];
    [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.top.equalTo(self.tabBar);
            make.height.mas_equalTo(0.2);
    }];
}


- (PictureViewController *)homeVC{
    if (!_homeVC) {
        _homeVC = [[PictureViewController alloc]init];
        _homeVC.yp_tabItemImage = SQGetImage(@"icon_menu_shouye_line");
        _homeVC.yp_tabItemSelectedImage = SQGetImage(@"icon_menu_shouye");
//        _homeVC.yp_tabItemTitle = SQNSLocalString(@"交换");
    }
    return _homeVC;
}

- (SouSuoViewController *)sousuo{
    if (!_sousuo) {
        _sousuo = [[SouSuoViewController alloc]init];
        _sousuo.yp_tabItemImage = SQGetImage(@"sousuo");
        _sousuo.yp_tabItemSelectedImage = SQGetImage(@"sousuo");
//        _messageVC.yp_tabItemTitle = SQNSLocalString(@"信息");
    }
    return _sousuo;
}


- (MessageViewController *)messageVC{
    if (!_messageVC) {
        _messageVC = [[MessageViewController alloc]init];
        _messageVC.yp_tabItemImage = SQGetImage(@"icon_menu_news_line");
        _messageVC.yp_tabItemSelectedImage = SQGetImage(@"icon_menu_news");
//        _messageVC.yp_tabItemTitle = SQNSLocalString(@"信息");
    }
    return _messageVC;
}

- (PeopleMapViewController *)aiVC{
    if (!_aiVC) {
        _aiVC = [[PeopleMapViewController alloc]init];
        _aiVC.yp_tabItemImage = SQGetImage(@"icon_menu_xingzuo_line");
        _aiVC.yp_tabItemSelectedImage = SQGetImage(@"icon_menu_xingzuo");
//        _aiVC.yp_tabItemTitle = SQNSLocalString(@"AI");
    }
    return _aiVC;
}

- (MeViewController *)meVC{
    if (!_meVC) {
        _meVC = [[MeViewController alloc]init];
        _meVC.yp_tabItemImage = SQGetImage(@"icon_menu_mine_line");
        _meVC.yp_tabItemSelectedImage = SQGetImage(@"icon_menu_mine_select");
//        _meVC.yp_tabItemTitle = SQNSLocalString(@"个人");
    }
    return _meVC;
}

@end
